# 测试

import unittest
# assertEqual(a, b) 核实a ==b
# assertNoEqual(a, b) 核实 a != b
# assertTrue(x) 核实x为True
# aaaertFalse(x) 核实x为False
# assertIn(item, list) 核实item 在 list中
# assertNotIn(item, list) 核实item 不在 list 中


from name_function import get_fomatted_name


def custum_test():
    """手动测试 get_fomatted_name"""
    print("Enter 'q' at any time to quit.")
    while True:
        first = input("\nPlease give me a first name:")
        if first == 'q':
            break
        last = input("\nPlease give me a last name")
        if last == 'q':
            break

        formatted_name = get_fomatted_name(first, last)
        print("\t Neatyl formatted name:" + formatted_name + '.')

class NamesTestCase(unittest.TestCase):
    """使用 unittest 测试 get_fomatted_name"""

    def test_first_last_name(self):
        formatted_name = get_fomatted_name('janis', 'joplin')
        self.assertEqual(formatted_name, 'Janis Joplin')

    def test_first_last_middle_name(self):
        formatted_name = get_fomatted_name('wo', 'mozart', 'ada')
        self.assertEqual(formatted_name, 'Wo Ada Mozart')

unittest.main()

